//
//  HZL_StoreTableViewCell.m
//  B_Project
//
//  Created by dllo on 15/11/24.
//  Copyright © 2015年 HZL. All rights reserved.
//

#import "HZL_StoreTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface HZL_StoreTableViewCell ()
@property (nonatomic, strong) UIImageView *img;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *subTitle;
@property (nonatomic, strong) UILabel *tagg;
@property (nonatomic, strong) UILabel *side;
@end
@implementation HZL_StoreTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.img = [[UIImageView alloc] init];
        self.img.contentMode = UIViewContentModeScaleAspectFill;
        self.img.clipsToBounds = YES;
        [self.contentView addSubview:self.img];
        
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.textColor = [UIColor whiteColor];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont boldSystemFontOfSize:20];
        [self.contentView addSubview:self.titleLabel];
        
        self.subTitle = [[UILabel alloc] init];
        self.subTitle.textColor = [UIColor whiteColor];
        self.subTitle.textAlignment = NSTextAlignmentCenter;
        self.subTitle.font = [UIFont boldSystemFontOfSize:15];
        [self.contentView addSubview:self.subTitle];
        
        self.tagg = [[UILabel alloc] init];
        self.tagg.backgroundColor = [UIColor blackColor];
        self.tagg.textColor = [UIColor whiteColor];
        self.tagg.textAlignment = NSTextAlignmentCenter;
        self.tagg.font = [UIFont boldSystemFontOfSize:13];
        [self.contentView addSubview:self.tagg];
        
        self.side = [[UILabel alloc] init];
        self.side.layer.borderColor = [[UIColor blackColor] CGColor];
        self.side.layer.borderWidth = 2;
        [self.contentView addSubview:self.side];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.img.frame = CGRectMake(10, 10, self.contentView.frame.size.width - 20, self.contentView.frame.size.height - 10);
    self.titleLabel.frame = CGRectMake(0, self.contentView.frame.size.height/2 - 25, self.contentView.frame.size.width, 30);
    self.subTitle.frame = CGRectMake(0, self.contentView.frame.size.height/2 +5, self.contentView.frame.size.width, 25);
    self.tagg.frame = CGRectMake(self.contentView.frame.size.width-63, 20, 50, 22);
    self.side.frame = CGRectMake(self.contentView.frame.size.width-66, 17, 56, 28);
}
- (void)setModel:(HZL_StoreModel *)model
{
    if (_model != model) {
        _model = model;
    }
    self.titleLabel.text = model.title;
    self.subTitle.text = model.subTitle;
    self.tagg.text = model.tag;
    [self.img sd_setImageWithURL:[NSURL URLWithString:model.img]];
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
